package v1

import (
	"net/http"
	"toy-car/models"
	"toy-car/pkg/e"

	"github.com/gin-gonic/gin"
)

// @Tags System
// @Summary 获取配置文件内容
// @Security ApiKeyAuth
// @Produce  application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /system/getSystemConfig [post]
func GetSystemConfig(c *gin.Context) {

	code := e.SUCCESS
	err, config := models.GetSystemConfig()
	if err != nil {
		code = e.ERROR
	}

	c.JSON(http.StatusOK, gin.H{
		"code": code,
		"msg":  e.GetMSG(code),
		"data": config,
	})
}

func SetSystemConfig(c *gin.Context) {

	code := e.SUCCESS
	c.JSON(http.StatusOK, gin.H{
		"code": code,
		"msg":  e.GetMSG(code),
		"data": true,
	})
}
